﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LifeSoftLibary;
using LifeSoft.BusinessObject;
using LifeSoft.DataLayer;
using Microsoft.Win32;

namespace LifeSoft.Controller
{
    class LoginCtr
    {
        public Boolean getSysUserLogin (SysLogLoginInfo frm)
        {
            long userId = new LoginData().getUserLogin(frm.userName, frm.password);

            if (userId != null && userId != 0)
            {
                RegistryKey hKey = Registry.LocalMachine;
                RegistryKey hKSoft = hKey.OpenSubKey("Software", true);
                RegistryKey hkMine = hKSoft.CreateSubKey("LifeSoft");
                hkMine.SetValue("SysUserId", userId);
                hkMine.Close();
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
